package org.luxor.commons.elasticsearch.service;

import org.elasticsearch.ElasticsearchException;
import org.luxor.commons.elasticsearch.entity.LogEsPO;
import org.luxor.commons.elasticsearch.entity.LogEsSearchDTO;
import org.luxor.commons.elasticsearch.metadata.EsPageQuery;
import org.luxor.commons.elasticsearch.metadata.EsPageResult;

/**
 * @author Mr.Yan  @date 2019/11/22
 */
public interface ElasticTestService {

    /**
     * 异步保存文档
     *
     * @param logEs 文档内容
     * @throws ElasticsearchException
     */
    void asyncSave(LogEsPO logEs) throws ElasticsearchException;

    /**
     * 根据文档id,删除文档
     *
     * @param docId 文档id
     * @throws ElasticsearchException
     */
    void asyncDelete(String docId) throws ElasticsearchException;

    /**
     * 异步更新文档
     *
     * @param logEs 文档内容
     * @throws ElasticsearchException
     */
    void asyncUpdate(LogEsPO logEs) throws ElasticsearchException;

    /**
     * 分页查询文档
     *
     * @param query 查询参数
     * @throws ElasticsearchException
     */
    EsPageResult<LogEsPO> searchPage(EsPageQuery<LogEsSearchDTO> query) throws ElasticsearchException;

    /**
     * 根据文档id,获取一条文档内容
     *
     * @param docId 文档id
     * @throws ElasticsearchException
     */
    LogEsPO getOneByDocId(String docId) throws ElasticsearchException;

}
